<template>
	<view class="inquirySummary customTitleBar" :style="{paddingTop: statusBarHeight}">
		<view class="custom-status-bar" :style="{backgroundColor: customTitleBarBg,height:statusBarHeight}"></view>
		<view class="custom-nav-bar" :style="{top:statusBarHeight,backgroundColor: customTitleBarBg,}">
			<view class="btn-icon-green" @click="goback">返回</view>
			<text class="title-green">问诊小结</text>
		</view>
		<view class="base-info-wrap">
			<view class="base-info">
				<view class="base-info-header"><text class="title">您的基本资料</text></view>
				<view class="form">
					<view class="form-item" v-if="yhBingliInfoVOTwo.sex!=null&&yhBingliInfoVOTwo.isMarry!=null&&(yhBingliInfoVOTwo.sex!=0||yhBingliInfoVOTwo.isMarry==1)">
						<view class="form-label"  v-if="yhBingliInfoVOTwo.sex==0&&yhBingliInfoVOTwo.isMarry==1">丈夫姓氏</view>
						<view class="form-label"  v-if="yhBingliInfoVOTwo.sex==1">本人姓氏</view>
						<view class="form-content">{{yhBingliInfoVOTwo.manSurname}}</view>
					</view>
					<view class="form-item"  v-if="yhBingliInfoVOTwo.sex!=null&&yhBingliInfoVOTwo.isMarry!=null&&(yhBingliInfoVOTwo.sex!=0||yhBingliInfoVOTwo.isMarry==1)">
						<view class="form-label"  v-if="yhBingliInfoVOTwo.sex==0&&yhBingliInfoVOTwo.isMarry==1">丈夫年龄</view>
						<view class="form-label"  v-if="yhBingliInfoVOTwo.sex==1">本人年龄</view>
						<view class="form-content">{{yhBingliInfoVOTwo.age}}</view>
					</view>
					<view class="form-item"  v-if="yhBingliInfoVOTwo.sex!=null&&yhBingliInfoVOTwo.isMarry!=null&&(yhBingliInfoVOTwo.sex!=0||yhBingliInfoVOTwo.isMarry==1)">
						<view class="form-label"  v-if="yhBingliInfoVOTwo.sex==0&&yhBingliInfoVOTwo.isMarry==1">丈夫照片</view>
						<view class="form-label"  v-if="yhBingliInfoVOTwo.sex==1">本人照片</view>
						<view class="form-content" v-if="yhBingliInfoVOTwo.manSurnameImage!=null&&yhBingliInfoVOTwo.manSurnameImage!=''" ><u--image :showLoading="true" :src="yhBingliInfoVOTwo.manSurnameImage" width="80px" height="80px"></u--image> </view>
				<view class="form-content" v-else >无 </view>
					
					</view>
					<view class="form-item"  v-if="yhBingliInfoVOTwo.sex!=null&&yhBingliInfoVOTwo.isMarry!=null&&(yhBingliInfoVOTwo.sex!=1||yhBingliInfoVOTwo.isMarry==1)">
						<view class="form-label" v-if="yhBingliInfoVOTwo.sex==1">妻子姓氏</view>
						<view class="form-label" v-if="yhBingliInfoVOTwo.sex==0&&yhBingliInfoVOTwo.isMarry==1">本人姓氏</view>
						<view class="form-content">{{yhBingliInfoVOTwo.wmanSurname}}</view>
					</view>
					<view class="form-item" v-if="yhBingliInfoVOTwo.sex!=null&&yhBingliInfoVOTwo.isMarry!=null&&(yhBingliInfoVOTwo.sex!=1||yhBingliInfoVOTwo.isMarry==1)">
						<view class="form-label" v-if="yhBingliInfoVOTwo.sex==1">妻子年龄</view>
						<view class="form-label" v-if="yhBingliInfoVOTwo.sex==0&&yhBingliInfoVOTwo.isMarry==1">本人年龄</view>
						<view class="form-content">{{yhBingliInfoVOTwo.wage}} 岁</view>
					</view>
					<view class="form-item" v-if="yhBingliInfoVOTwo.sex!=null&&yhBingliInfoVOTwo.isMarry!=null&&(yhBingliInfoVOTwo.sex!=1||yhBingliInfoVOTwo.isMarry==1)">
						<view class="form-label" v-if="yhBingliInfoVOTwo.sex==1">妻子照片</view>
						<view class="form-label" v-if="yhBingliInfoVOTwo.sex==0&&yhBingliInfoVOTwo.isMarry==1">本人照片</view>
						<view class="form-content" v-if="yhBingliInfoVOTwo.wmanSurnameImage!=null&&yhBingliInfoVOTwo.wmanSurnameImage!=''"><u--image :showLoading="true" :src="yhBingliInfoVOTwo.wmanSurnameImage" width="80px" height="80px"></u--image> </view>
					<view class="form-content" v-else >无 </view>
					
					</view>
					<view class="form-item" v-if="yhBingliInfoVOTwo.fatherName!=null">
						<view class="form-label">父亲</view>
						<view class="form-content">{{yhBingliInfoVOTwo.fatherName}}</view>
					</view>
					<view class="form-item" v-if="yhBingliInfoVOTwo.motherName!=null">
						<view class="form-label">母亲</view>
						<view class="form-content">{{yhBingliInfoVOTwo.motherName}}</view>
					</view>
					<view class="form-item">
						<view class="form-label">疾病类型</view>
						<view class="form-content">{{yhBingliInfoVOTwo.diseaseType==null?'无':yhBingliInfoVOTwo.diseaseType}}</view>
					</view>
					<view class="form-item-column">
						<view class="form-label">病情简介</view>
						<view class="form-content" style="min-height: 200rpx;">{{yhBingliInfoVOTwo.diseaseDesc}}</view>
					</view>
					<view class="form-item-column">
						<view class="form-label">系统检测风险提示</view>
						<view class="form-rate"><uni-rate :readonly="true" :value="yhBingliInfoVOTwo.warningLevel" :size="26" activeColor="#00BD8D" :margin="19" /></view>
					</view>
					<view class="form-item-column">
						<view class="form-label">专家建议</view>
						<view class="form-content"  v-if="yhBingliInfoVOTwo.expertOpinion!=null">{{yhBingliInfoVOTwo.expertOpinion}}</view>
						<view class="form-content"  v-if="yhBingliInfoVOTwo.expertOpinion==null">付费等待专家填写建议</view>
					</view>
				</view>
			</view>
		</view>
	<!--	<view class="footer-fixed-btn"> <text class="btn btn-border">确定</text> <text class="btn btn-green">查看专家建议</text></view>-->
		<!-- 底部导航s -->
		<view class="menu-bar">
			<view class="menu-bar-item" @click="toHome"><view class="icon icon-home"></view><text>首页</text></view>
			<view class="menu-bar-item" @click="toPersonalCenter"><view class="icon icon-me"></view><text>我的</text></view>
		</view>
		<!-- 底部导航s -->
		<!-- 收费标准弹层s -->
		<uni-transition class="base-popup" :show="showBasePopup" :mode-class="['fade']" :styles="popupClass">
			<view class="container" v-if="showChargesPopup">
				<view class="title-bar"><view class="title">收费标准</view><view class="btn-close" @click="showBasePopup = false">关闭弹窗</view></view>
				<view class="content">为了更好的获得帮助，请尽可能详细描述病情，专家提示如何预防。</view>
				<view class="price"><text class="price-item">{{yhBingliInfoVO.payPrice}}元</text></view>
				<view class="btn">
					<view class="btn-item" @click="goPlay">去付款</view>
				</view>
			</view>
			<view class="container" v-if="!showChargesPopup">
				<view class="title-bar"><view class="title">提示结果</view><view class="btn-close" @click="showBasePopup = false">关闭弹窗</view></view>
				<view class="content" style="min-height: 245rpx;">友情提示：诊断结果将在48小时内完成，请耐心等待，谢谢！</view>
				<view class="btn">
					<view class="btn-item" @click="showBasePopup = false">确定</view>
				</view>
			</view>
		</uni-transition>
		<uni-transition :mode-class="['fade']" :styles="maskClass" :show="showBasePopup" @click="showBasePopup = false" />
		<!-- 收费标准弹层e -->
		
		
		<!-- 确认付款弹窗s -->
		<u-keyboard
			default=""
			ref="uKeyboard" 
			mode="number" 
			:mask="true" 
			:mask-close-able="false"
			:dot-enabled="false" 
			:show="showPay"
			:safe-area-inset-bottom="true"
			:tooltip="false"
			@change="onPayChange"
			@backspace="onBackspace">
			<view>
		
			
			 <u-row customStyle="margin-bottom: 10px;justify-content: center;">
			           <text>{{yhBingliInfoVO.payPrice}}</text>
			           <text style="font-size: 30rpx;padding-left: 10rpx;color: #0AC797;">元</text>
<!-- 			           <view style="padding-left: 20rpx;" data-flag="false" @tap="closedPay">
			           	<u-icon name="close" color="#333333" size="28"></u-icon>
			           </view> -->
			                </u-row>
							<u-row customStyle="margin-bottom: 10px;justify-content: center;">
							          <u-code-input v-model="password"  :space="5" :disabledKeyboard="true" :maxlength="6" dot	@finish="finish"></u-code-input>
							               </u-row>
										   <u-row customStyle="margin-bottom: 10px;justify-content: center;"  >
										       	<view>支付键盘(模拟测试支付888888)</view>      
										                  </u-row>
			</view>
		</u-keyboard>
	</view>
</template>

<script>
	let that=this;
	import {getBloddInfoById ,getBloddInfoNopayById,payNotify} from '@/common/api.js';
	import uniTransition from '@/components/uni-transition/uni-transition.vue'
	var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px'
	export default {
		components: {
      uniTransition
    },
		data() {
			return {
				showPay:false,//模拟支付使用 后续废弃
				password:'',//模拟支付使用 后续废弃
				showBasePopup: true,
				showChargesPopup: true,
				maskClass: {
					'position': 'fixed',
					'bottom': 0,
					'top': 0,
					'left': 0,
					'right': 0,
					'zIndex': 9990,
					'backgroundColor': 'rgba(0, 0, 0, 0.5)'
				},
				popupClass: {
					'position': 'fixed',
					'bottom': '0',
					'left': '0',
					'right': '0',
					'zIndex': 9991,
				},
				customTitleBarBg: 'rgba(255,255,255,0)',
				statusBarHeight: statusBarHeight,
				tabsList:[
					{
						name: '首页'
					}
				],
				tabsCurrent: 0,
				searchInput: '',
				orderNo:'',
				yhBingliInfoVO:null,
				yhBingliInfoVOTwo:null
			}
		},
		onPageScroll:function(e){  
      this.customTitleBarBg = 'rgba(255,255,255,'+e.scrollTop / 60+')'; 
    },onLoad(options) {
			that=this;
			this.orderNo=options.orderNo;
			this.status=options.status;
			
		},onShow() {
			
			this.getBloddInfoById();
		},
		methods: {
			// tabsChange(index) {
			// 	this.tabsCurrent = index;
			// },
			goback(){
				uni.navigateBack({
					
				})
			},
			getNopayInfo(){
				// get请求
				getBloddInfoNopayById({params:{ 'orderNo':this.orderNo}}).then(data => {
					console.log(data)
					this.yhBingliInfoVO=data;
				}).catch(() =>{
					
				})
			},getBloddInfoById(){
				getBloddInfoById({params:{ 'orderNo':this.orderNo}}).then(data => {
					this.yhBingliInfoVOTwo=data;
					console.log(this.yhBingliInfoVOTwo.status)
					console.log(data)
					if(this.yhBingliInfoVOTwo.status==1){
							this.getNopayInfo();
							this.showBasePopup=true;
					}else if(this.yhBingliInfoVOTwo.status==2){
						this.showBasePopup=false;
					}
				}).catch(() =>{
					
				})
			},
			clearInput() {
				this.searchInput = '';
			},
			toSearch() {
				uni.navigateTo({
					url: '../search/search',
				});
			},
			toHundredFamilySurnames() {
				uni.navigateTo({
					url: '../hundredFamilySurnames/hundredFamilySurnames',
				});
			},
			toCase() {
				uni.navigateTo({
					url: '../case/case',
				});
			},
			toPaper() {
				uni.navigateTo({
					url: '../paper/paper',
				});
			},
			toSurnameOrigin() {
				uni.navigateTo({
					url: '../surnameOrigin/surnameOrigin',
				});
			},
			toHome() {
				uni.redirectTo({
					url: '../index/index',
				});
			},
			toPersonalCenter() {
				uni.redirectTo({
					url: '../personalCenter/personalCenter',
				});
			},onPayChange(val){//模拟支付使用 后续废弃
				if(this.password.length<6){
					this.password += val;
				}
				
				if(this.password.length>=6){
					if(this.password=="888888"){
						this.moniPay();
					}else{
						this.$refs.uToast.show({
						 title:'密码错误',
						 type: 'error'
						})
						this.password="";
					}
					
				}
			},onBackspace(e){//模拟支付使用 后续废弃
				if(this.password.length>0){
					this.password = this.password.substring(0,this.password.length-1);
				}
			},moniPay(){//模拟支付使用 后续废弃
				uni.showLoading({
					title:'模拟支付中'
				})
				
				setTimeout(()=>{
					uni.hideLoading();
					this.showPay = false;
					uni.showToast({
						icon:'success',
						title:'支付成功'
					})
					that.payNotify();
						this.showChargesPopup=false;
					/* uni.redirectTo({
						url:'../PaymentStatus/PaymentStatus?actualPrice='+that.payform.actualPrice
					}) */
					//回调微信支付成功方法  模拟
				},2000);
			},goPlay(){
				//this.showBasePopup=false;
				this.showPay=true;
				
			},finish(){//模拟支付使用 后续废弃
				console.log(11111)
			},payNotify(){//模拟通知后续 去掉
			
			payNotify({params:{ 'orderNo':this.yhBingliInfoVO.orderNo},custom:{'toast':false, 'catch': false }}).then(data => {
					
				}).catch(() =>{
			
					
			})
				/* let req = {'orderId':this.payform.orderId};
				console.log(req)
					this.$u.api.payNotify(req).then(res => {//模拟通知
						  	console.log(res);
							if(res.code!=200){
								this.$refs.uToast.show({
								 title: res.msg,
								 type: 'error'
								})
								return;
							}	
							
							
						  }) */
			}
			
		}
	}
</script>

<style scoped>
</style>
<style>
	page{min-height: 100%;background:#fff url(~@/static/img/home_bg.png) no-repeat 0 0;background-size: 750rpx 931rpx;}
</style>
